﻿#pragma once
#include <string>
using std::string;
using namespace std;

struct SOW {
	int week;
	int sec;
	double sesec;
};
struct CalendT {
	int year; int month; int day; int hour; int min; int sec;
	double sesec;
};
struct BaseT {
	time_t sec;
	double sesec;
};

class TimeSys
{
public:
	TimeSys() {
		originT = { 1970,01,01,0,0,0 };
	};
	~TimeSys();
public:
	SOW calend2sow(CalendT t0);
	CalendT sow2calend(SOW t0);
	BaseT str2baseT(string t);
	bool compare(SOW t1, SOW t2);
	double time_minus(BaseT t1, BaseT t2);
	bool print_time(CalendT t);
	bool print_time(SOW t);

public:
	CalendT str2calendT(string t);
	BaseT sow2baseT(SOW t);
	SOW   baseT2sow(BaseT t);
	BaseT calend2baseT(CalendT t);
	CalendT baseT2calend(BaseT t);

protected:
	CalendT originT;
};

class GPSTime : public TimeSys
{
public:
	GPSTime() {
		originT = { 1980,01,06,0,0,0 };
	}
};

class BDSTime : public TimeSys
{
public:
	BDSTime() {
		originT = { 2006,01,01,0,0,0 };
	}
};